package com.tansun.easycare.rule.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.tansun.easycare.rule.codeblock.entity.RuleCodeblock;
import com.tansun.easycare.rule.datamodel.entity.RuleDataEntity;
import com.tansun.easycare.rule.datamodel.entity.RuleDataparams;
import com.tansun.easycare.rule.datamodel.entity.RuleDataset;
import com.tansun.easycare.rule.decisiontree.model.DecisionSubNode;
import com.tansun.easycare.rule.decisiontree.model.DecisionSubNodeItem;
import com.tansun.easycare.rule.ruleflow.entity.RuleFlowRects;
import com.tansun.easycare.rule.ruleflow.model.RuleFlowModel;
import com.tansun.easycare.rule.rulegroup.entity.RuleGroup;
import com.tansun.easycare.rule.rulegroup.model.RuleSetVO;
import com.tansun.easycare.rule.rulemange.entity.RuleManage;
import com.tansun.easycare.rule.ruleversion.entity.RuleVersioninfo;
import com.tansun.easycare.rule.scoremodel.entity.RuleScoreInfo;
import com.tansun.easycare.rule.scoremodel.model.ScoreEntity;
import com.tansun.easycare.rule.scoremodel.model.ScoreItem;
import com.tansun.easycare.rule.table.decisiontable.model.DecisionTableItem;
import com.tansun.easycare.rule.table.decisiontable.model.DecisionTableRow;
import com.tansun.easycare.rule.table.decisiontable.model.TableEntity;
import com.tansun.rule.sparkCode.entity.codeblock.RuleCodeblockSC;
import com.tansun.rule.sparkCode.entity.datamodel.RuleDataEntitySC;
import com.tansun.rule.sparkCode.entity.datamodel.RuleDataparamsSC;
import com.tansun.rule.sparkCode.entity.datamodel.RuleDatasetSC;
import com.tansun.rule.sparkCode.entity.decisiontabel.DecisionTableItemSC;
import com.tansun.rule.sparkCode.entity.decisiontabel.DecisionTableRowSC;
import com.tansun.rule.sparkCode.entity.decisiontabel.TableEntitySC;
import com.tansun.rule.sparkCode.entity.decisiontree.DecisionSubNodeItemSC;
import com.tansun.rule.sparkCode.entity.decisiontree.DecisionSubNodeSC;
import com.tansun.rule.sparkCode.entity.deployline.RuleVersionVO;
import com.tansun.rule.sparkCode.entity.ruleflow.RuleFlowModelSC;
import com.tansun.rule.sparkCode.entity.ruleflow.RuleFlowRectsSC;
import com.tansun.rule.sparkCode.entity.rulegroup.RuleGroupSC;
import com.tansun.rule.sparkCode.entity.rulegroup.RuleSetSC;
import com.tansun.rule.sparkCode.entity.rulemanage.RuleManageSC;
import com.tansun.rule.sparkCode.entity.scoremodel.RuleScoreInfoSC;
import com.tansun.rule.sparkCode.entity.scoremodel.ScoreEntitySC;
import com.tansun.rule.sparkCode.entity.scoremodel.ScoreItemSC;

public class ClassChangeUtils {

	public static RuleCodeblockSC changeClass(RuleCodeblock ruleCodeblock) {
		if(ruleCodeblock==null) {
			return null;
		}
		RuleCodeblockSC ruleCodeblockSC = new RuleCodeblockSC();
		ruleCodeblockSC.setCodeBody(ruleCodeblock.getCodeBody());
		ruleCodeblockSC.setFuncImport(ruleCodeblock.getFuncImport());
		ruleCodeblockSC.setFunctionName(ruleCodeblock.getFunctionName());
		ruleCodeblockSC.setId(ruleCodeblock.getId());
		ruleCodeblockSC.setManageId(ruleCodeblock.getManageId());
		ruleCodeblockSC.setModelCode(ruleCodeblock.getModelCode());
		ruleCodeblockSC.setModelName(ruleCodeblock.getModelName());
		ruleCodeblockSC.setParameters(ruleCodeblock.getParameters());
		ruleCodeblockSC.setProjectCode(ruleCodeblock.getProjectCode());
		ruleCodeblockSC.setReturnType(ruleCodeblock.getReturnType());
		ruleCodeblockSC.setStrCodeBody(ruleCodeblock.getStrCodeBody());
		return ruleCodeblockSC;
	}
	
	public static RuleFlowRectsSC changeClass(RuleFlowRects ruleFlowRects) {
		if(ruleFlowRects==null) {
			return null;
		}
		RuleFlowRectsSC ruleFlowRectsSC = new RuleFlowRectsSC();
		ruleFlowRectsSC.setConstaints(ruleFlowRects.getConstaints());
		ruleFlowRectsSC.setId(ruleFlowRects.getId());
		ruleFlowRectsSC.setManageId(ruleFlowRects.getManageId());
		ruleFlowRectsSC.setModelCode(ruleFlowRects.getModelCode());
		ruleFlowRectsSC.setModelName(ruleFlowRects.getModelName());
		ruleFlowRectsSC.setNodeId(ruleFlowRects.getRectCode());
		ruleFlowRectsSC.setProjectCode(ruleFlowRects.getProjectCode());
		ruleFlowRectsSC.setRectCode(ruleFlowRects.getRectCode());
		ruleFlowRectsSC.setRectName(ruleFlowRects.getRectName());
		ruleFlowRectsSC.setRectType(ruleFlowRects.getRectType());
		ruleFlowRectsSC.setRectVersion(ruleFlowRects.getVersion());
		ruleFlowRectsSC.setVersion(ruleFlowRects.getVersion());
		return ruleFlowRectsSC;
	}
	public static RuleVersionVO changeClass(RuleVersioninfo ruleVersioninfo) {
		if(ruleVersioninfo==null) {
			return null;
		}
		RuleVersionVO ruleVersionVO = new RuleVersionVO();
		ruleVersionVO.setChampionChallengerInfo(ruleVersioninfo.getChampionChallengerInfo());
		ruleVersionVO.setContont(ruleVersioninfo.getRuleContent());
		ruleVersionVO.setGlobalCode(ruleVersioninfo.getGlobalCode());
		ruleVersionVO.setId(ruleVersioninfo.getId());
		ruleVersionVO.setJarIds(ruleVersioninfo.getJarIds());
		ruleVersionVO.setJavaClassName(ruleVersioninfo.getJavaClassName());
		ruleVersionVO.setJavaImportClasses(ruleVersioninfo.getJavaImportClasses());
		ruleVersionVO.setJavaInnerClasses(ruleVersioninfo.getJavaInnerClasses());
		ruleVersionVO.setJavaPackages(ruleVersioninfo.getJavaPackages());
		ruleVersionVO.setModelType(ruleVersioninfo.getModelType());
		ruleVersionVO.setRuleContentJava(ruleVersioninfo.getRuleContentJava());
		return ruleVersionVO;
	}
	
	public static RuleManageSC changeClass(RuleManage ruleManage) {
		if(ruleManage==null) {
			return null;
		}
		RuleManageSC ruleManageSC = new RuleManageSC();
		ruleManageSC.setCode(ruleManage.getCode());
		ruleManageSC.setCountSalience(ruleManage.getCountSalience());
		ruleManageSC.setId(ruleManage.getId());
		ruleManageSC.setIsSingle(ruleManage.getIsSingle());
		ruleManageSC.setIsTemp(ruleManage.getIsTemp());
		ruleManageSC.setModelType(ruleManage.getModelType());
		ruleManageSC.setName(ruleManage.getName());
		ruleManageSC.setOldId(ruleManage.getOldId());
		ruleManageSC.setOldVersion(ruleManage.getOldVersion());
		ruleManageSC.setProjectCode(ruleManage.getProjectCode());
		ruleManageSC.setStatus(ruleManage.getStatus());
		ruleManageSC.setVersion(ruleManage.getVersion());
		return ruleManageSC;
	}
	
	public static RuleManage changeClass(RuleManageSC ruleManageSC) {
		if(ruleManageSC==null) {
			return null;
		}
		RuleManage ruleManage = new RuleManage();
		ruleManage.setCode(ruleManageSC.getCode());
		ruleManage.setCountSalience(ruleManageSC.getCountSalience());
		ruleManage.setId(ruleManageSC.getId());
		ruleManage.setIsSingle(ruleManageSC.getIsSingle());
		ruleManage.setIsTemp(ruleManageSC.getIsTemp());
		ruleManage.setModelType(ruleManageSC.getModelType());
		ruleManage.setName(ruleManageSC.getName());
		ruleManage.setOldId(ruleManageSC.getOldId());
		ruleManage.setOldVersion(ruleManageSC.getOldVersion());
		ruleManage.setProjectCode(ruleManageSC.getProjectCode());
		ruleManage.setStatus(ruleManageSC.getStatus());
		ruleManage.setVersion(ruleManageSC.getVersion());
		return ruleManage;
	}
	
	public static RuleGroupSC changeClass(RuleGroup ruleGroup) {
		if(ruleGroup==null) {
			return null;
		}
		RuleGroupSC ruleGroupSC = new RuleGroupSC();
		ruleGroupSC.setActions(ruleGroup.getActions());
		ruleGroupSC.setActivationGroup(ruleGroup.getActivationGroup());
		ruleGroupSC.setComment(ruleGroup.getComment());
		ruleGroupSC.setDateEffective(ruleGroup.getDateEffective());
		ruleGroupSC.setDateExpires(ruleGroup.getDateExpires());
		ruleGroupSC.setEnabled(ruleGroup.getEnabled());
		ruleGroupSC.setEvals(ruleGroup.getEvals());
		ruleGroupSC.setFacts(ruleGroup.getFacts());
		ruleGroupSC.setGroupCode(ruleGroup.getGroupCode());
		ruleGroupSC.setId(ruleGroup.getId());
		ruleGroupSC.setManageId(ruleGroup.getManageId());
		ruleGroupSC.setProjectCode(ruleGroup.getProjectCode());
		ruleGroupSC.setRuleName(ruleGroup.getRuleName());
		ruleGroupSC.setSalience(ruleGroup.getSalience());
		ruleGroupSC.setSeq(ruleGroup.getSeq());
		ruleGroupSC.setSort(ruleGroup.getSort());
		ruleGroupSC.setStatus(ruleGroup.getStatus());
		ruleGroupSC.setTxtType(ruleGroup.getTxtType());
		ruleGroupSC.setVersion(ruleGroup.getVersion());
		return ruleGroupSC;
	}
	
	public static RuleSetSC changeClass(RuleSetVO ruleSetVO) {
		if(ruleSetVO==null) {
			return null;
		}
		RuleSetSC ruleSetSC = new RuleSetSC();
		ruleSetSC.setRuleManage(changeClass(ruleSetVO.getRuleManage()));
		
		List<RuleGroup> rules = ruleSetVO.getRules();
		if(rules==null) {
			ruleSetSC.setRules(null);
		}else {
			List<RuleGroupSC> rulesSC = new ArrayList<RuleGroupSC>();
			for(RuleGroup ruleGroup:rules) {
				rulesSC.add(changeClass(ruleGroup));
			}
			ruleSetSC.setRules(rulesSC);
		}
		return ruleSetSC;
	}
	
	public static RuleDataparamsSC changeClass(RuleDataparams ruleDataparams) {
		if(ruleDataparams==null) {
			return null;
		}
		RuleDataparamsSC ruleDataparamsSC = new RuleDataparamsSC();
		ruleDataparamsSC.setChzn(ruleDataparams.getChzn());
		ruleDataparamsSC.setClassName(ruleDataparams.getClassName());
		ruleDataparamsSC.setCollection(ruleDataparams.getCollection());
		ruleDataparamsSC.setDatasetId(ruleDataparams.getDatasetId());
		ruleDataparamsSC.setDefaultValue(ruleDataparams.getDefaultValue());
		ruleDataparamsSC.setDeleteflag(ruleDataparams.getDeleteflag());
		ruleDataparamsSC.setDomain(ruleDataparams.getDomain());
		ruleDataparamsSC.setDomainId(ruleDataparams.getDomainId());
		ruleDataparamsSC.setDomainStr(ruleDataparams.getDomainStr());
		ruleDataparamsSC.setDomainType(ruleDataparams.getDomainType());
		ruleDataparamsSC.setFormatDefaultValue(ruleDataparams.getFormatDefaultValue());
		ruleDataparamsSC.setFormatDomainStr(ruleDataparams.getFormatDomainStr());
		ruleDataparamsSC.setId(ruleDataparams.getId());
		ruleDataparamsSC.setIsCollections(ruleDataparams.getIsCollections());
		ruleDataparamsSC.setIsDerives(ruleDataparams.getIsDerives());
		ruleDataparamsSC.setIsout(ruleDataparams.getIsout());
		ruleDataparamsSC.setLength(ruleDataparams.getLength());
		ruleDataparamsSC.setMathStr(ruleDataparams.getMathStr());
		ruleDataparamsSC.setName(ruleDataparams.getName());
		ruleDataparamsSC.setParamDesc(ruleDataparams.getParamDesc());
		ruleDataparamsSC.setPattern(ruleDataparams.getPattern());
		ruleDataparamsSC.setProjectcode(ruleDataparams.getProjectcode());
		ruleDataparamsSC.setType(ruleDataparams.getType());
		return ruleDataparamsSC;
	}
	
	public static RuleDataEntitySC changeClass(RuleDataEntity ruleDataEntity) {
		if(ruleDataEntity==null) {
			return null;
		}
		RuleDataEntitySC ruleDataEntitySC = new RuleDataEntitySC();

		List<RuleDataparams> ruleDataparamList = ruleDataEntity.getRuleDataparams();
		if(ruleDataparamList==null) {
			ruleDataEntitySC.setRuleDataparams(null);
		}else {
			List<RuleDataparamsSC> ruleDataparamsSC = new ArrayList<RuleDataparamsSC>();
			for(RuleDataparams ruleDataparam:ruleDataparamList) {
				ruleDataparamsSC.add(changeClass(ruleDataparam));
			}
			ruleDataEntitySC.setRuleDataparams(ruleDataparamsSC);
		}
		ruleDataEntitySC.setRuleDataset(changeClass(ruleDataEntity.getRuleDataset()));
		return ruleDataEntitySC;
	}
	
	public static RuleDatasetSC changeClass(RuleDataset ruleDataset) {
		if(ruleDataset==null) {
			return null;
		}
		RuleDatasetSC ruleDatasetSC = new RuleDatasetSC();
		ruleDatasetSC.setChzn(ruleDataset.getChzn());
		ruleDatasetSC.setDataDesc(ruleDataset.getDataDesc());
		ruleDatasetSC.setDeleteflag(ruleDataset.getDeleteflag());
		Map<String,RuleDataparams> mapRuleDataparams = ruleDataset.getFieldMap();
		if(mapRuleDataparams==null) {
			ruleDatasetSC.setFieldMap(null);
		}else{
			Map<String,RuleDataparamsSC> mapRuleDataparamsSC = new HashMap<String,RuleDataparamsSC>();
			for(String key:mapRuleDataparams.keySet()) {
				mapRuleDataparamsSC.put(key, changeClass(mapRuleDataparams.get(key)));
			}
			ruleDatasetSC.setFieldMap(mapRuleDataparamsSC);
		}
		ruleDatasetSC.setId(ruleDataset.getId());
		ruleDatasetSC.setmFieldNames(ruleDataset.getmFieldNames());
		ruleDatasetSC.setName(ruleDataset.getName());
		ruleDatasetSC.setParamChzn(ruleDataset.getParamChzn());
		ruleDatasetSC.setParamType(ruleDataset.getParamType());
		ruleDatasetSC.setProjectcode(ruleDataset.getProjectcode());
		return ruleDatasetSC;
	}
	
	public static RuleScoreInfoSC changeClass(RuleScoreInfo ruleScoreInfo) {
		if(ruleScoreInfo==null) {
			return null;
		}
		RuleScoreInfoSC ruleScoreInfoSC = new RuleScoreInfoSC();
		ruleScoreInfoSC.setContrastVals(ruleScoreInfo.getContrastVals());
		ruleScoreInfoSC.setFormula(ruleScoreInfo.getFormula());
		ruleScoreInfoSC.setFormulaLabel(ruleScoreInfo.getFormulaLabel());
		ruleScoreInfoSC.setId(ruleScoreInfo.getId());
		ruleScoreInfoSC.setIsOther(ruleScoreInfo.getIsOther());
		ruleScoreInfoSC.setLabel(ruleScoreInfo.getLabel());
		ruleScoreInfoSC.setLowerOpt(ruleScoreInfo.getLowerOpt());
		ruleScoreInfoSC.setLowerVal(ruleScoreInfo.getLowerVal());
		ruleScoreInfoSC.setManageId(ruleScoreInfo.getManageId());
		ruleScoreInfoSC.setParentTreeId(ruleScoreInfo.getParentTreeId());
		ruleScoreInfoSC.setProjectCode(ruleScoreInfo.getProjectCode());
		ruleScoreInfoSC.setScopeDesc(ruleScoreInfo.getScopeDesc());
		ruleScoreInfoSC.setScoreVal(ruleScoreInfo.getScoreVal());
		ruleScoreInfoSC.setSectionType(ruleScoreInfo.getSectionType());
		ruleScoreInfoSC.setSeq(ruleScoreInfo.getSeq());
		ruleScoreInfoSC.setSymbol(ruleScoreInfo.getSymbol());
		ruleScoreInfoSC.setTreeId(ruleScoreInfo.getTreeId());
		ruleScoreInfoSC.setUpperOpt(ruleScoreInfo.getUpperOpt());
		ruleScoreInfoSC.setUpperVal(ruleScoreInfo.getUpperVal());
		ruleScoreInfoSC.setVersion(ruleScoreInfo.getVersion());
		return ruleScoreInfoSC;
	}
	
	public static ScoreItemSC changeClass(ScoreItem scoreItem) {
		if(scoreItem==null) {
			return null;
		}
		ScoreItemSC scoreItemSC = new ScoreItemSC();
		scoreItemSC.setClassName(scoreItem.getClassName());
		scoreItemSC.setContentType(scoreItem.getContentType());
		scoreItemSC.setDataType(scoreItem.getDataType());
		scoreItemSC.setDefaultValue(scoreItem.getDefaultValue());
		scoreItemSC.setDomain(scoreItem.getDomain());
		scoreItemSC.setFormula(scoreItem.getFormula());
		scoreItemSC.setFormulaLabel(scoreItem.getFormulaLabel());
		scoreItemSC.setId(scoreItem.getId());
		scoreItemSC.setIsDerives(scoreItem.getIsDerives());
		List<RuleScoreInfo> list = scoreItem.getList();
		if(list==null) {
			scoreItemSC.setList(null);
		}else {
			List<RuleScoreInfoSC> listSC = new ArrayList<RuleScoreInfoSC>();
			for(RuleScoreInfo ruleScoreInfo:list) {
				listSC.add(changeClass(ruleScoreInfo));
			}
			scoreItemSC.setList(listSC);
		}
		scoreItemSC.setManageId(scoreItem.getManageId());
		scoreItemSC.setNamecn(scoreItem.getNamecn());
		scoreItemSC.setNameen(scoreItem.getNameen());
		scoreItemSC.setPosition(scoreItem.getPosition());
		scoreItemSC.setProjectCode(scoreItem.getProjectCode());
		scoreItemSC.setScoreParam(scoreItem.getScoreParam());
		scoreItemSC.setSeq(scoreItem.getSeq());
		scoreItemSC.setTreeId(scoreItem.getTreeId());
		scoreItemSC.setVersion(scoreItem.getVersion());
		return scoreItemSC;
	}
	
	public static ScoreEntitySC changeClass(ScoreEntity scoreEntity) {
		if(scoreEntity==null) {
			return null;
		}
		ScoreEntitySC scoreEntitySC = new ScoreEntitySC();
		scoreEntitySC.setScoreModel(changeClass(scoreEntity.getScoreModel()));
		List<ScoreItem> treeList = scoreEntity.getTreeList();
		if(treeList==null) {
			scoreEntitySC.setTreeList(null);
		}else {
			List<ScoreItemSC> treeListSC = new ArrayList<ScoreItemSC>();
			for(ScoreItem scoreItem:treeList) {
				treeListSC.add(changeClass(scoreItem));
			}
			scoreEntitySC.setTreeList(treeListSC);
		}
		return scoreEntitySC;
	}
	public static DecisionTableItemSC changeClass(DecisionTableItem decisionTableItem) {
		if(decisionTableItem==null) {
			return null;
		}
		DecisionTableItemSC decisionTableItemSC = new DecisionTableItemSC();
		decisionTableItemSC.setClassName(decisionTableItem.getClassName());
		decisionTableItemSC.setCollection(decisionTableItem.getCollection());
		decisionTableItemSC.setContentType(decisionTableItem.getContentType());
		decisionTableItemSC.setControlValues(decisionTableItem.getControlValues());
		decisionTableItemSC.setControlValue(decisionTableItem.getControlValue());
		decisionTableItemSC.setDataType(decisionTableItem.getDataType());
		decisionTableItemSC.setDefaultValue(decisionTableItem.getDefaultValue());
		decisionTableItemSC.setDomain(decisionTableItem.getDomain());
		decisionTableItemSC.setFormula(decisionTableItem.getFormula());
		decisionTableItemSC.setFormulaLabel(decisionTableItem.getFormulaLabel());
		decisionTableItemSC.setIsDerives(decisionTableItem.getIsDerives());
		decisionTableItemSC.setLowerOpt(decisionTableItem.getLowerOpt());
		decisionTableItemSC.setNameCN(decisionTableItem.getNameCN());
		decisionTableItemSC.setNameEN(decisionTableItem.getNameEN());
		decisionTableItemSC.setPosition(decisionTableItem.getPosition());
		decisionTableItemSC.setPattern(decisionTableItem.getPattern());
		decisionTableItemSC.setRuleDataparams(changeClass(decisionTableItem.getRuleDataparams()));
		decisionTableItemSC.setTabId(decisionTableItem.getTabId());
		decisionTableItemSC.setUpperOpt(decisionTableItem.getUpperOpt());

		List<DecisionTableItem> rowItems= decisionTableItem.getRowItems();
		if(rowItems==null) {
			decisionTableItemSC.setRowItems(null);
		}else {
			List<DecisionTableItemSC> rowItemsSC= new ArrayList<DecisionTableItemSC>();
			for(DecisionTableItem each:rowItems) {
				rowItemsSC.add(changeClass(each));
			}
			decisionTableItemSC.setRowItems(rowItemsSC);
		}
		return decisionTableItemSC;
	}
	public static DecisionTableRowSC changeClass(DecisionTableRow decisionTableRow) {
		if(decisionTableRow==null) {
			return null;
		}
		DecisionTableRowSC decisionTableRowSC = new DecisionTableRowSC();
		decisionTableRowSC.setRowIndex(decisionTableRow.getRowIndex());
		List<DecisionTableItem> rowItems= decisionTableRow.getRowItems();
		if(rowItems==null) {
			decisionTableRowSC.setRowItems(null);
		}else {
			List<DecisionTableItemSC> rowItemsSC= new ArrayList<DecisionTableItemSC>();
			for(DecisionTableItem decisionTableItem:rowItems) {
				rowItemsSC.add(changeClass(decisionTableItem));
			}
			decisionTableRowSC.setRowItems(rowItemsSC);
		}

		return decisionTableRowSC;
	}
	public static TableEntitySC changeClass(TableEntity tableEntity) {
		if(tableEntity==null) {
			return null;
		}
		TableEntitySC tableEntitySC = new TableEntitySC();
		tableEntitySC.setDecisionTbl(changeClass(tableEntity.getDecisionTbl()));
		List<DecisionTableRow> tableList = tableEntity.getTableList();
		if(tableList==null) {
			tableEntitySC.setTableList(null);
		}else {
			List<DecisionTableRowSC> tableListSC= new ArrayList<DecisionTableRowSC>();
			for(DecisionTableRow decisionTableRow:tableList) {
				tableListSC.add(changeClass(decisionTableRow));
			}
			tableEntitySC.setTableList(tableListSC);
		}

		return tableEntitySC;
	}

	public static DecisionSubNodeItemSC changeClass(DecisionSubNodeItem decisionSubNodeItem) {
		if(decisionSubNodeItem==null) {
			return null;
		}
		DecisionSubNodeItemSC decisionSubNodeItemSC = new DecisionSubNodeItemSC();
		decisionSubNodeItemSC.setClassName(decisionSubNodeItem.getClassName());
		decisionSubNodeItemSC.setCollection(decisionSubNodeItem.getCollection());
		decisionSubNodeItemSC.setControlValue(decisionSubNodeItem.getControlValue());
		decisionSubNodeItemSC.setDataType(decisionSubNodeItem.getDataType());
		decisionSubNodeItemSC.setDefaultValue(decisionSubNodeItem.getDefaultValue());
		decisionSubNodeItemSC.setDisabled(decisionSubNodeItem.getDisabled());
		decisionSubNodeItemSC.setDomain(decisionSubNodeItem.getDomain());
		decisionSubNodeItemSC.setFormula(decisionSubNodeItem.getFormula());
		decisionSubNodeItemSC.setFormulaLabel(decisionSubNodeItem.getFormulaLabel());
		decisionSubNodeItemSC.setIsDerives(decisionSubNodeItem.getIsDerives());
		decisionSubNodeItemSC.setLeftOpt(decisionSubNodeItem.getLeftOpt());
		decisionSubNodeItemSC.setNameCN(decisionSubNodeItem.getNameCN());
		decisionSubNodeItemSC.setNameEN(decisionSubNodeItem.getNameEN());
		decisionSubNodeItemSC.setPattern(decisionSubNodeItem.getPattern());
		decisionSubNodeItemSC.setPosition(decisionSubNodeItem.getPosition());
		decisionSubNodeItemSC.setRightOpt(decisionSubNodeItem.getRightOpt());
		decisionSubNodeItemSC.setSeq(decisionSubNodeItem.getSeq());
		decisionSubNodeItemSC.setSymbol(decisionSubNodeItem.getSymbol());
		return decisionSubNodeItemSC;
	}
	public static DecisionSubNodeSC changeClass(DecisionSubNode decisionSubNode) {
		if(decisionSubNode==null) {
			return null;
		}
		DecisionSubNodeSC decisionSubNodeSC = new DecisionSubNodeSC();
		decisionSubNodeSC.setControlValue(decisionSubNode.getControlValue());
		decisionSubNodeSC.setExtreId(decisionSubNode.getExtreId());
		decisionSubNodeSC.setFloor(decisionSubNode.getFloor());
		decisionSubNodeSC.setId(decisionSubNode.getId());
		decisionSubNodeSC.setIsLeaf(decisionSubNode.getIsLeaf());
		decisionSubNodeSC.setName(decisionSubNode.getName());
		decisionSubNodeSC.setNum(decisionSubNode.getNum());
		decisionSubNodeSC.setPid(decisionSubNode.getPid());
		decisionSubNodeSC.setType(decisionSubNode.getType());
		
		List<DecisionSubNodeItem> nodeItems = decisionSubNode.getNodeItems();
		if(nodeItems==null) {
			decisionSubNodeSC.setNodeItems(null);
		}else {
			List<DecisionSubNodeItemSC> nodeItemsSC= new ArrayList<DecisionSubNodeItemSC>();
			for(DecisionSubNodeItem decisionSubNodeItem:nodeItems) {
				nodeItemsSC.add(changeClass(decisionSubNodeItem));
			}
			decisionSubNodeSC.setNodeItems(nodeItemsSC);
		}
		
		List<DecisionSubNodeItem> resultItems = decisionSubNode.getResultItems();
		if(resultItems==null) {
			decisionSubNodeSC.setResultItems(null);
		}else {
			List<DecisionSubNodeItemSC> resultItemsSC= new ArrayList<DecisionSubNodeItemSC>();
			for(DecisionSubNodeItem decisionSubNodeItem:resultItems) {
				resultItemsSC.add(changeClass(decisionSubNodeItem));
			}
			decisionSubNodeSC.setResultItems(resultItemsSC);
		}
		return decisionSubNodeSC;
	}
	
	public static RuleFlowModelSC changeClass(RuleFlowModel ruleInfo) {
		if(ruleInfo==null) {
			return null;
		}
		RuleFlowModelSC ruleInfoSC = new RuleFlowModelSC();
		ruleInfoSC.setCode(ruleInfo.getCode());
		ruleInfoSC.setManageId(ruleInfo.getManageId());
		ruleInfoSC.setName(ruleInfo.getName());
		ruleInfoSC.setProjectCode(ruleInfo.getProjectCode());
		ruleInfoSC.setRuleflowInfo(ruleInfo.getRuleflowInfo());
		ruleInfoSC.setVersion(ruleInfo.getVersion());
		return ruleInfoSC;
	}
	
	@SuppressWarnings("unchecked")
	public static List<RuleDataEntitySC> changeClassList(List<RuleDataEntity> ruleDataEntityList) {
		if(ruleDataEntityList==null) {
			return null;
		}
		List<RuleDataEntitySC> ruleDataEntitySCList = new ArrayList<RuleDataEntitySC>();
		if(ruleDataEntityList.size()==0) {
			return ruleDataEntitySCList;
		}
		for(RuleDataEntity ruleDataEntity:ruleDataEntityList) {
			ruleDataEntitySCList.add(changeClass(ruleDataEntity));
		}
		return ruleDataEntitySCList;
	}
	
}
